/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tpgen.grammar;

import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author shanki
 */
public class Terminal implements Symbol {
    protected String name;
    
    public Terminal(String name) {
        this.name = name;
    }

    @Override
    public boolean isUsable() {
        return true;
    }
    
    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public Collection<Symbol> expand(Context context) {
        return new ArrayList<Symbol>();
    }

    @Override
    public String toUserString() {
        return name;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Terminal) {
            Terminal other = (Terminal)obj;
            
            return this.name.equals(other.name);
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }

}